<script type="text/javascript">
var weekdaystxt=["Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"]

function showLocalTime(container, offsetMinutes){
	this.container=document.getElementById(container)
	var servertimestring='<? print date("F d, Y H:i:s", time())?>'
	this.localtime=this.serverdate=new Date(servertimestring)
	this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time
	this.updateTime()
	this.updateContainer()
}

showLocalTime.prototype.updateTime=function(){
	var thisobj=this
	this.localtime.setSeconds(this.localtime.getSeconds()+1)
	setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

showLocalTime.prototype.updateContainer=function(){
	var thisobj=this
	var hour=this.localtime.getHours()
	var minutes=this.localtime.getMinutes()
	var seconds=this.localtime.getSeconds()
	var dayofweek=weekdaystxt[this.localtime.getDay()]
	if(seconds==0 && minutes%10==0) this.container.style.color='red'
	this.container.innerHTML=formatField(hour)+":"+formatField(minutes)+":"+formatField(seconds)
	setTimeout(function(){thisobj.updateContainer()}, 1000) //update container every second
}

function formatField(num){
	return (num<=9)? "0"+num : num//if this is minute or sec field
}
</script>
<div style="float:right; font-size:12px;" id="Reloj"></div>
<script type="text/javascript">
	new showLocalTime("Reloj", 0)
</script>